<?php
	include(dirname(__FILE__) . '/../model/mMesannonces.php');
	
	// Instantciation de la classe
	$mysql = new mMesannonces();
	
	// Affichage de la vue 'gestion des annonces'
	if(isset($_GET['display']) && $_GET['display'] == true) {
	
		$userId = $_SESSION['userid'];
		$mesAnnonces = $mysql->getAnnonces($userId);
	
		include(dirname(__FILE__) . '/../view/gestion.php');
	} 
	// Suppression d'une annonce'
	else if(isset($_GET['delete']) && $_GET['delete'] == true) {
	
		$userId = $_SESSION['userid'];
		$mesAnnonces = $mysql->getAnnonces($userId);
	
		$item = $_SESSION['item'];
		$mysql->deleteAnnonce($item);
	
		include(dirname(__FILE__) . '/../view/main.php');
	}
	else {
		include(dirname(__FILE__) . '/../view/gestion.php');
	}

?>